#include "widget.h"
#include "ui_widget.h"
#include <QWheelEvent>
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
    , total(0)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::wheelEvent(QWheelEvent *event)
{
    // 滚轮事件：delta() 表示滚动了多远
    total += event->delta();
    qDebug() << total;
}

